package Com.javaserver.dao;

import Com.javaserver.bean.admid;
import Com.javaserver.utils.DB;

import java.util.List;

public class addmiserver {
    //添加
    public  admid admidadd(admid a){
        int i=DB.executeUpdate("insert into admin (account,password) values (?,?) " ,a.getAccount(),a.getPassword());
        if (i==-1){
            return  null;
        }
        return  a;
    }
    //显示
    public List admi(Integer page) {
        List list = DB.executeQuery("select * from admin limit ?, 10", (page - 1) * 10);
        return list;
    }
    //删除
    public  boolean  admidele(admid a){
            String sql="delete from admin where U_id=?";
            int i =DB.executeUpdate(sql,a.getId());
            return  1>0;
    }
   // 修改
   public void admiup(admid a){
       DB.executeUpdate("update  admin set  U_id=?,account=?,password=? where U_id=?",a.getId(),a.getAccount(),a.getPassword());

   }

}
